<?php

namespace app\factory\controller;

use app\common\respond\HttpApi;
use app\factory\logic\PigHealthLogic;

class PigHealthController 
{
    /**
     * @Description 上报
     * @author: zj
     * @param HttpApi $respond
     * @time 2024/03/23 14:55:28
     * @return \think\response\Json
     */
    public function report(HttpApi $respond)
    {
        $param = [
            'Id' => request()->post('Id'),
            'PigId' => request()->post('PigId'),
            'Temperature' => request()->post('Temperature'),
            'Heartrate' => request()->post('Heartrate'),
            'Sao2' => request()->post('Sao2'),
            'Pi' => request()->post('Pi'),
            'Br' => request()->post('Br'),
            'RecordTime' => request()->post('RecordTime')
        ];
        $rule = [
            'Id' => 'require|integer|>:0',
            'RecordTime' => 'require|integer|>:0'
        ];
        validate($rule)->check($param);

        $logic = new PigHealthLogic();
        $data = $logic->report($param['Id'],$param);

        return $respond->success([]);
    }
}